﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Comun.Queries
{
    class Delete : QueryBuilder
    {

        public Delete()
        {
        }

        public Delete from(String tabla)
        {
            this.tabla = tabla;
            return this;
        }

        public Delete where(String clausulaWhere)
        {
            this.clausulaWhere = clausulaWhere;
            return this;
        }

        public override string build()
        {
            StringBuilder query = new StringBuilder();
            query.Append(DELETE);
            query.Append(FROM).Append(this.tabla);
            if (this.noEsVacio(this.clausulaWhere))
            {
                query.Append(WHERE).Append(this.clausulaWhere);
            }
            return query.ToString();
        }
    }
}
